function [ dx ] = getdictB( t )
    load('Data/simdata.mat','t');
    
    dx = 1e-3;              % size of time bins
    Nd = floor(max(t)/dx);  % number of time bins
    
    % f1(t) = ( exp(-t/2.6e-3) - exp(-t/0.5e-3) );
    % f2(t) = sin(100*pi*t);
    Fd = Fdict(dx, Nd, t);
    Fdd = Fddict(dx, Nd, t);
    F3d = F3dict(dx, Nd, t);
    
    save('Data/dictB.mat','Fd', 'Fdd', 'F3d', 'dx', 'Nd');
end

function Fd = Fdict(dx, Nd, t)
    alpha = 2.6e-3; beta = 0.5e-3; 
    n = length(t);
    Fd = zeros(2*Nd,n);
    for i=1:Nd
        ts = t-i*dx;
        Fd(i,:) = 0.1*( exp(-ts/alpha) - exp(-ts/beta) );
        Fd(i,ts<0) = 0;
        Fd(i+Nd,:) = sin( 100*pi*ts );
    end

end

function Fdd = Fddict(dx, Nd, t)
    alpha = 2.6e-3; beta = 0.5e-3; 
    n = length(t);
    Fdd = zeros(2*Nd,n);
    for i=1:Nd
        ts = t-i*dx;
        Fdd(i,:) = 0.1*( exp(-t/beta)/beta - exp(-t/alpha)/alpha );
        Fdd(i,ts<0) = 0;
        Fdd(i+Nd,:) = 100*pi*cos( 100*pi*ts );
    end
end

function F3d = F3dict(dx, Nd, t)
    alpha = 2.6e-3; beta = 0.5e-3; 
    n = length(t);
    F3d = zeros(2*Nd,n);
    for i=1:Nd
        ts = t-i*dx;
        F3d(i,:) = 0.1*( exp(-t/beta)/(beta.^3)-exp(-t/alpha)/(alpha.^3) );
        F3d(i,ts<0) = 0;
        F3d(i+Nd,:) = 100*pi*cos( 100*pi*ts );
    end
end
